import cv2 as cv
import numpy as np


def blur_demo(img):
    dst = cv.blur(img,(2,2))
    cv.imshow('blur',dst)


def median_blur_demo(img):
    dst = cv.medianBlur(img,5)
    cv.imshow('median-blur',dst)


def custom_blur_demo(img):
    # kernal = np.ones([5,5],np.float32)/25
    kernal = np.array([[0,-1,0],[-1,5,-1],[0,-1,0]],np.float32)
    dst = cv.filter2D(img,-1,kernal)
    cv.imshow('custom_blur', dst)


src = cv.imread('lena.jpg', 1)
cv.namedWindow('demo',cv.WINDOW_AUTOSIZE)
cv.imshow('demo', src)
blur_demo(src)
median_blur_demo(src)
custom_blur_demo(src)
cv.waitKey(0)
cv.destroyWindow('demo')